<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Whisper: riff_wave_writer.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Whisper
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">riff_wave_writer.h</div>  </div>
</div>
<div class="contents">
<a href="riff__wave__writer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="preprocessor">#ifndef __RIFF_WAVE_WRITER_H__</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span><span class="preprocessor">#define __RIFF_WAVE_WRITER_H__ 1</span>
<a name="l00004"></a>00004 <span class="preprocessor"></span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;fstream&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;stdint.h&gt;</span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="preprocessor">#include &quot;<a class="code" href="wave__format__tag_8h.html">wave_format_tag.h</a>&quot;</span>
<a name="l00010"></a>00010 
<a name="l00011"></a><a class="code" href="classCRiffWaveWriter.html">00011</a> <span class="keyword">class </span><a class="code" href="classCRiffWaveWriter.html">CRiffWaveWriter</a>
<a name="l00012"></a>00012 {
<a name="l00013"></a>00013 <span class="keyword">public</span>:
<a name="l00014"></a>00014         <a class="code" href="classCRiffWaveWriter.html#aa53741b339e618387b8f763cfad3d521">CRiffWaveWriter</a>();
<a name="l00015"></a>00015         <span class="keyword">virtual</span> <a class="code" href="classCRiffWaveWriter.html#ae0a0d8ebe1dacf1693e010d048b60bb1">~CRiffWaveWriter</a>();
<a name="l00016"></a>00016 
<a name="l00024"></a>00024         <span class="keywordtype">bool</span> <a class="code" href="classCRiffWaveWriter.html#a9df878bb108ed772c51d86f9bd7623d5">create</a>(std::string pFilename,
<a name="l00025"></a>00025                         <a class="code" href="namespaceNWaveFormatTag.html#a984a591ddf2ea06019b5881d5b83364d">NWaveFormatTag::EFormatTag</a> pFormatTag,
<a name="l00026"></a>00026                         uint16_t pChannels,
<a name="l00027"></a>00027                         uint32_t pSamplesPerSecond,
<a name="l00028"></a>00028                         uint16_t pBitsPerSample,
<a name="l00029"></a>00029                         <span class="keywordtype">bool</span> pOverwrite);
<a name="l00030"></a>00030 
<a name="l00036"></a>00036         <span class="keywordtype">bool</span> <a class="code" href="classCRiffWaveWriter.html#a7a7346ea4390c7c1d47de30a9d77daf1">close</a>();
<a name="l00037"></a>00037 
<a name="l00042"></a>00042         <span class="keywordtype">bool</span> <a class="code" href="classCRiffWaveWriter.html#a96ca87814699a4fedb3788aff1d7f344">sync</a>();
<a name="l00043"></a>00043         
<a name="l00049"></a>00049         std::string <a class="code" href="classCRiffWaveWriter.html#a45143c51ce3291bbcd28b4f50bd75ebf">getWaveInfo</a>();
<a name="l00050"></a>00050 
<a name="l00058"></a>00058         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCRiffWaveWriter.html#ac1cb8527f81dfc4bc8d9fd687b598b65">sampleCount</a>();
<a name="l00059"></a>00059         
<a name="l00066"></a>00066         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCRiffWaveWriter.html#aa92494e4e8aa940c690547a5d146bb0a">channels</a>();
<a name="l00067"></a>00067 
<a name="l00071"></a>00071         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCRiffWaveWriter.html#a5074261cb6ae4a1e9a8b401a4045328e">bytePerSample</a>();
<a name="l00072"></a>00072         
<a name="l00085"></a>00085         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCRiffWaveWriter.html#aaa2ebde31d156e23ea6f1b4ad3202c27">writeSamples</a>(<span class="keywordtype">void</span>* pSamples,
<a name="l00086"></a>00086                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pCount);
<a name="l00087"></a>00087         
<a name="l00088"></a>00088 <span class="keyword">private</span>:
<a name="l00089"></a><a class="code" href="classCRiffWaveWriter.html#a442fa1e496142cb99c240a6e21ff3fff">00089</a>         std::ofstream <a class="code" href="classCRiffWaveWriter.html#a442fa1e496142cb99c240a6e21ff3fff">mWav</a>;
<a name="l00090"></a><a class="code" href="classCRiffWaveWriter.html#a3ee71d7cc7e9cadc91440d38b21f0423">00090</a>         uint32_t <a class="code" href="classCRiffWaveWriter.html#a3ee71d7cc7e9cadc91440d38b21f0423">mRiffChunksize</a>;
<a name="l00091"></a>00091         
<a name="l00092"></a><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html">00092</a>         <span class="keyword">struct </span><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html">SFormatChunk</a>
<a name="l00093"></a>00093         {
<a name="l00094"></a><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#ae6e7c3f430a5abdda3eea355cb1600ca">00094</a>                 uint16_t <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#ae6e7c3f430a5abdda3eea355cb1600ca">formatTag</a>;
<a name="l00095"></a><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#aec8e981ce33996273d51a974fdf279a4">00095</a>                 uint16_t <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#aec8e981ce33996273d51a974fdf279a4">channels</a>;
<a name="l00096"></a><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a8671ad093e2e0cae3a80ad52bd221afc">00096</a>                 uint32_t <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a8671ad093e2e0cae3a80ad52bd221afc">samplesPerSec</a>;
<a name="l00097"></a><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#aad99699ce34ba40d0475a498fe2cc689">00097</a>                 uint32_t <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#aad99699ce34ba40d0475a498fe2cc689">avgBytesPerSec</a>;
<a name="l00098"></a><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a411913d6e59e380afa097d4d50c9329a">00098</a>                 uint16_t <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a411913d6e59e380afa097d4d50c9329a">blockAlign</a>;
<a name="l00099"></a><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a29e94f399942ebae13d52af8e2585095">00099</a>                 uint16_t <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a29e94f399942ebae13d52af8e2585095">bitsPerSample</a>;
<a name="l00100"></a>00100 
<a name="l00101"></a>00101                 <span class="comment">// these values are changed by create()</span>
<a name="l00102"></a><a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#ab37128d1241bab1fb96f08f3875c9c4c">00102</a>                 <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#ab37128d1241bab1fb96f08f3875c9c4c">SFormatChunk</a>()
<a name="l00103"></a>00103                                 :<a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#ae6e7c3f430a5abdda3eea355cb1600ca">formatTag</a>(1), <span class="comment">// for PCM</span>
<a name="l00104"></a>00104                                 channels(2), <span class="comment">// mono: 1</span>
<a name="l00105"></a>00105                                 <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a8671ad093e2e0cae3a80ad52bd221afc">samplesPerSec</a>(44100),
<a name="l00106"></a>00106                                 <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#aad99699ce34ba40d0475a498fe2cc689">avgBytesPerSec</a>(176400), <span class="comment">// mono: 88200</span>
<a name="l00107"></a>00107                                 <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a411913d6e59e380afa097d4d50c9329a">blockAlign</a>(4), <span class="comment">// mono: 2</span>
<a name="l00108"></a>00108                                 <a class="code" href="structCRiffWaveWriter_1_1SFormatChunk.html#a29e94f399942ebae13d52af8e2585095">bitsPerSample</a>(16) {}
<a name="l00109"></a>00109         } <a class="code" href="classCRiffWaveWriter.html#a46a1d2c07c8488ef3de12a6baf46ae62">mFormat</a>;
<a name="l00110"></a>00110         
<a name="l00111"></a><a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html">00111</a>         <span class="keyword">struct </span><a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html">SDataChunk</a>
<a name="l00112"></a>00112         {
<a name="l00113"></a><a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#ac99d0329eb2d06d173dc051e7077f497">00113</a>                 std::ofstream::pos_type <a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#ac99d0329eb2d06d173dc051e7077f497">sampleStartPos</a>;
<a name="l00114"></a><a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#a711ecafc5bca5507cac43002b4e6947d">00114</a>                 uint32_t <a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#a711ecafc5bca5507cac43002b4e6947d">dataChunksize</a>;
<a name="l00115"></a><a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#a8c51956403b8b3eb4bcbc9a30fc59383">00115</a>                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#a8c51956403b8b3eb4bcbc9a30fc59383">bytePerSample</a>;
<a name="l00116"></a>00116 
<a name="l00117"></a><a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#a5cacfed44817a4098bd1aaa251ea3434">00117</a>                 <a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#a5cacfed44817a4098bd1aaa251ea3434">SDataChunk</a>()
<a name="l00118"></a>00118                                 :<a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#ac99d0329eb2d06d173dc051e7077f497">sampleStartPos</a>(0),
<a name="l00119"></a>00119                                 <a class="code" href="structCRiffWaveWriter_1_1SDataChunk.html#a711ecafc5bca5507cac43002b4e6947d">dataChunksize</a>(0),
<a name="l00120"></a>00120                                 bytePerSample(2) {}
<a name="l00121"></a>00121         } <a class="code" href="classCRiffWaveWriter.html#a97db304507830c6f38da38d431b102ca">mData</a>;
<a name="l00122"></a>00122         
<a name="l00123"></a>00123         <span class="keywordtype">bool</span> <a class="code" href="classCRiffWaveWriter.html#a15cbe18ad4bc7cf8857aa038c633e919">writeChunks</a>();
<a name="l00124"></a>00124 };
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Wed Jan 25 2012 22:00:39 for Whisper by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
